﻿$(function () {
    $.fn.serializeJson = function () {
        var serializeObj = {};
        $(this.serializeArray()).each(function () {
            //if (this.value != "") {
            serializeObj[this.name] = this.value;
            //}
        });
        return serializeObj;
    };

    $("#i_create").click(function () {
        var queryParams = $("form").serializeJson();
        queryParams.r = Math.random();
        $.post("/Book/Create", queryParams, function (data, status) {
            if (!data.error) {
                alert(data.msg);
                location.href = "/Book/Index";
            } else {
                alert(data.msg);
            }
        });
    });

});